package Reproductor;


import javazoom.jl.decoder.Equalizer.EQFunction;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.Line.Info;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Port;

/**
 *
 * @author Pablo
 */

public class Volumen {
             
    private static Info source = Port.Info.SPEAKER;
    
    public static void setVolumen(float volumen){
        if (AudioSystem.isLineSupported(source)) {
            try  {
                Port outline = (Port) AudioSystem.getLine(source);
                outline.open();                
                FloatControl volumeControl = (FloatControl) outline.getControl(FloatControl.Type.VOLUME);                
                //System.out.println("       volume: " + volumeControl.getValue() );                
                volumeControl.setValue(volumen);                
            } 
            catch (LineUnavailableException ex) {
                System.err.println("source not supported");
                ex.printStackTrace();
            }            
        } 
    }        
} 


